public class Test023 {
    //将数组内的数字以字符串的形式输出
    public static void main(String[] args) {
        int[] array = {1,2,3,4};
        String ret = myToString(array);
        System.out.println(ret);
    }

    public static String myToString(int[] array) {
        String num ="[";
        for (int i=0;i<array.length;i++) {
            num = num+array[i];
            if(i != array.length-1){
                num += ",";
            }
        }
            num += "]";
        return num;
        }
    }
